import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login'
import Layout from '../views/layout'
import Chart from '../views/layout/chart'
import User from '../views/layout/user'
import Enterprise from '../views/layout/enterprise'
import Question from '../views/layout/question'
import Subject from '../views/layout/subject'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/layout',
    name: 'Layout',
    component: Layout,
    // 配置子路由
    children: [
      {
        path: 'chart',
        component: Chart
      },
      {
        path: 'user',
        component: User
      },
      {
        path: 'enterprise',
        component: Enterprise
      },
      {
        path: 'question',
        component: Question
      },
      {
        path: 'subject',
        component: Subject
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
